<!--oceny czastkowe-->
<script type="text/javascript">
{literal}
function toggleStatus(obj, urlValue) {
	$(obj).attr('disabled', 'disabled');
	$.ajax({
		url: urlValue ,
		type:'GET',
		success: function(){
			$(obj).removeAttr('disabled');
		}
	});
}
{/literal}
</script>
<h1>Oceny cząstkowe</h1>
{mainoptions title="Filtr"}
	<form action="{url category=Votes}" method="post">
		<table cellspacing="0" cellpadding="0" border="0" width="100%" class="commonTable">
			<tr>
				<th>Kategoria</th>
				<td>
					<select name="cat_id">
						<option value=''>Wszystkie</option>
						{foreach from=$arrayObjCategories item=obj}
							<option value={$obj->getId()} {if $obj->getId() eq $currentCategory}selected=selected {/if}>{$obj->getName()}</option>
						{/foreach}
					</select>
				</td>
			</tr>
		</table>
		<p align="right"><input type="submit" value="Zastosuj" /></p>
	</form>
{/mainoptions}
{mainoptions title="Lista"}
<table cellspacing="0" cellpadding="0" border="0">
	<tr>
		<th>Lp.</th>
		<th>Nazwa</th>
		<th>Publikuj</th>
		<th>Overall</th>
		<th class="noSort">
			
			<div class="sort">
				<a class="ascendingAct" href="#">&nbsp;</a>
				<a class="descending" href="#">&nbsp;</a>
			</div>
		</th>
	</tr>
	
	{foreach from=$arrayObjVotes item=obj}
	<tr>
		<td>{tables type='lp' tid='vote_table' iteration=$smarty.foreach.list.iteration}<br />[{$obj->getId()}]</td>
		<td>{$obj->getName()}</td>
		<td>
			<input type="checkbox" {if $obj->getActive() == 1}checked="checked"{/if} onchange="toggleStatus(this, '{url Category=ToggleVoteActive id=$obj->getId()}');"/>
		</td>
		<td>
			<input type="checkbox" {if $obj->getOverall() == 1}checked="checked"{/if} onchange="toggleStatus(this, '{url Category=ToggleOverall id=$obj->getId()}');"/>
		</td>

<!--		<td>
		</td>		-->
		<td>	
			<a href="{url Category=VoteEdit id=$arrData.id vid=$obj->getId()}" class="edit">edytuj</a>

			<a onclick="if(!confirm('Czy na pewno chcesz usunąć ten element?'))return false;" href="{url Category=VoteDelete id=$obj->getId() redir=Votes}" class="delete">usuń</a>
		</td>
	</tr>
	{/foreach}
	<tr class="selAllRow">
				<td colspan="6">
					<div class="pager">
						{tables type='pagination' tid='category_table' all_count=$c}
						{tables type='on_page' tid='category_table'}
					</div>
				</td>
			</tr>
</table>
{/mainoptions}